package com.shop.Control;


import com.opensymphony.xwork2.ModelDriven;
import com.shop.actionentity.MerchantReg;
import com.shop.service.MerchantServiceImpl;
import com.shop.util.FormAjaxUtil;

/**
 * 
 * <b>注册<b>
 * @author 威 
 * <br>2017年12月
 *
 */
public class MerchantRegisterAction  extends SuperActionSupport implements ModelDriven<MerchantReg> {
	private static final long serialVersionUID = -5646824578488230600L;
	
	private MerchantReg mreg = new MerchantReg() ;

	@Override
	public MerchantReg getModel() {
		return mreg ;
	}
	
	public String execute(){
		MerchantServiceImpl merchantServiceImpl = (MerchantServiceImpl) getBean("merchantServiceImpl") ;
		System.out.println(mreg) ;
		try{
			System.out.println("register") ;
			System.out.println("获取到merchantServiceImpl："+merchantServiceImpl) ;
			merchantServiceImpl.register(mreg) ;
			print(FormAjaxUtil.failAccess(mreg.getCallbackObj(), "true")) ;
			return SUCCESS ;
		}catch (RuntimeException  e){
			System.out.println("有异常") ;
			System.out.println(FormAjaxUtil.failAccess(mreg.getCallbackObj(), "false"));
			print(FormAjaxUtil.failAccess(mreg.getCallbackObj(), "false")) ;
	        return SUCCESS ;
		}
	}
	
}
